<!DOCTYPE html><html lang="zh-CN,en,default"><head hexo-theme="https://github.com/volantis-x/hexo-theme-volantis/tree/4.3.1"><meta charset="utf-8"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin><meta name="renderer" content="webkit"><meta name="force-rendering" content="webkit"><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"><meta name="HandheldFriendly" content="True"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="preload" href="/css/first.css" as="style"><title>Linux学习笔记 - Tang&#39;s blog.</title><meta name="keywords" content="Linux"><link rel="alternate" href="/atom.xml" title="Tang's blog." type="application/atom+xml"><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/blog/favicon/browserconfig.xml"><meta name="theme-color" content="#ffffff"><link rel="apple-touch-icon" sizes="180x180" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_180x180.png"><link rel="icon" type="image/png" sizes="32x32" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_1o_16x16.png"><link rel="manifest" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/manifest2.json"><link rel="mask-icon" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/cf_image2vector.svg" color="#5bbad5"><link rel="shortcut icon" href="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/favicon/32favicon32.ico"><link rel="stylesheet" href="/css/first.css"><link rel="stylesheet" href="/css/style.css" media="print" onload='this.media="all",this.onload=null'><noscript><link rel="stylesheet" href="/css/style.css"></noscript><script id="loadcss"></script><script>window.MSInputMethodContext&&document.documentMode&&document.write('<style>html{overflow-x: hidden !important;overflow-y: hidden !important;}.kill-ie{text-align:center;height: 100%;margin-top: 15%;margin-bottom: 5500%;}</style><div class="kill-ie"><h1><b>抱歉，您的浏览器无法访问本站</b></h1><h3>微软已经于2016年终止了对 Internet Explorer (IE) 10 及更早版本的支持，<br/>继续使用存在极大的安全隐患，请使用当代主流的浏览器进行访问。</h3><br/><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong>了解详情 ></strong></a></div>')</script><noscript><style>html{overflow-x:hidden!important;overflow-y:hidden!important}.kill-noscript{text-align:center;height:100%;margin-top:15%;margin-bottom:5500%}</style><div class="kill-noscript"><h1><b>抱歉，您的浏览器无法访问本站</b></h1><h3>本页面需要浏览器支持（启用）JavaScript</h3><br> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.baidu.com/s?wd=启用JavaScript"><strong>了解详情 ></strong></a></div></noscript></head><body><header id="l_header" class="l_header always shadow blur show"><div class="container"><div id="wrapper"><div class="nav-sub"><p class="title"></p><ul class="switcher nav-list-h m-phone" id="pjax-header-nav-list"><li><a id="s-comment" class="fas fa-comments fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li><li><a id="s-toc" class="s-toc fas fa-list fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li></ul></div><div class="nav-main"> <a class="title flat-box" target="_self" href="/"><img no-lazy class="logo" src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/cf_o1x64.jpg"></a><div class="menu navigation"><ul class="nav-list-h m-pc"><li><a class="menuitem flat-box faa-parent animated-hover" href="/" id="home"><i class="fas fa-home fa-fw"></i> Home</a></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-th-list fa-fw"></i> Articles</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" id="categories"><i class="fas fa-folder-open fa-fw"></i> Categories</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" id="tags"><i class="fas fa-tags fa-fw"></i> Tags</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" id="archives"><i class="fas fa-archive fa-fw"></i> Archives</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-fan faa-spin animated fa-fw"></i> Play</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/catchTheCat/" id="catchTheCat"><i class="fas fa-cat faa-wrench animated-hover fa-fw"></i> Chat Noir</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-cog fa-spin fa-fw"></i> Tools</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> 暗黑模式</a></li><li></li><li><a class="menuitem flat-box"><i class="fas fa-compact-disc fa-fw music"></i> Music</a><ul class="list-v"><li><div class="aplayer-container"><meting-js theme="#1BCDFC" autoplay="false" volume="0.7" loop="all" order="list" fixed="false" list-max-height="320px" server="netease" type="playlist" id="5472211102" list-folded="true"></meting-js></div></li></ul></li><li></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-info-circle fa-fw"></i> Me</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/about/" id="about"><i class="fas fa-ellipsis-v fa-fw"></i> About</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="https://aner1001.gitee.io/resume/" target="_blank" id="https:aner1001giteeioresume"><i class="fas fa-clock fa-fw"></i> Resume</a></li></ul></li></ul></div><div id="tp-weather-widget"></div><script>!function(e,t,n,a,i,o,c,r){r=function(){o=t.createElement(n),c=t.getElementsByTagName(n)[0],o.src=i,o.charset="utf-8",o.async=1,c.parentNode.insertBefore(o,c)},e.SeniverseWeatherWidgetObject=a,e[a]||(e[a]=function(){(e[a].q=e[a].q||[]).push(arguments)}),e[a].l=+new Date,e.attachEvent?e.attachEvent("onload",r):e.addEventListener("load",r,!1)}(window,document,"script","SeniverseWeatherWidget","//cdn.sencdn.com/widget2/static/js/bundle.js?t="+parseInt(((new Date).getTime()/1e8).toString(),10)),window.SeniverseWeatherWidget("show",{flavor:"slim",location:"WTW3SJ5ZBJUY",geolocation:!0,language:"zh-Hans",unit:"c",theme:"auto",token:"563a4097-8461-469b-ac30-123bac0010d1",hover:"enabled",container:"tp-weather-widget"})</script><div class="m_search"><form name="searchform" class="form u-search-form"><i class="icon fas fa-search fa-fw"></i> <input type="text" class="input u-search-input" placeholder="Search..."></form></div><ul class="switcher nav-list-h m-phone"><li><a class="s-search fas fa-search fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a></li><li><a class="s-menu fas fa-bars fa-fw" target="_self" href="javascript:void(0)" rel="external nofollow noreferrer"></a><ul class="menu-phone list-v navigation white-box"><li><a class="menuitem flat-box faa-parent animated-hover" href="/" id="home"><i class="fas fa-home fa-fw"></i> Home</a></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-th-list fa-fw"></i> Articles</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/categories/" id="categories"><i class="fas fa-folder-open fa-fw"></i> Categories</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/tags/" id="tags"><i class="fas fa-tags fa-fw"></i> Tags</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="/archives/" id="archives"><i class="fas fa-archive fa-fw"></i> Archives</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-fan faa-spin animated fa-fw"></i> Play</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/catchTheCat/" id="catchTheCat"><i class="fas fa-cat faa-wrench animated-hover fa-fw"></i> Chat Noir</a></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-cog fa-spin fa-fw"></i> Tools</a><ul class="list-v"><li><a class="menuitem flat-box header toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> 暗黑模式</a></li><li></li></ul></li><li><a class="menuitem flat-box faa-parent animated-hover"><i class="fas fa-info-circle fa-fw"></i> Me</a><ul class="list-v"><li><a class="menuitem flat-box faa-parent animated-hover" href="/about/" id="about"><i class="fas fa-ellipsis-v fa-fw"></i> About</a></li><li><a class="menuitem flat-box faa-parent animated-hover" href="https://aner1001.gitee.io/resume/" target="_blank" id="https:aner1001giteeioresume"><i class="fas fa-clock fa-fw"></i> Resume</a></li></ul></li></ul></li></ul></div></div></div></header><div id="l_body"><div id="l_cover"><div id="full" class="cover-wrapper post blank" style="display:none"><div id="cover-backstretch"></div><div id="scroll-down" style="display:none"><i class="fa fa-chevron-down scroll-down-effects"></i></div></div></div><div id="safearea"><div class="body-wrapper" id="pjax-container"><div class="l_main"><article class="article post white-box reveal md shadow article-type-post" id="post" itemscope itemprop="blogPost"><div class="article-meta" id="top"><h1 class="title"> Linux学习笔记</h1><div class="new-meta-box"><div class="new-meta-item author"> <a class="author" href="/" rel="nofollow"><img no-lazy src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/img/cover/fav/cf_1o_x16.jpg"><p>汤晔飞</p></a></div><div class="new-meta-item category"><a class="notlink"><i class="fas fa-folder-open fa-fw" aria-hidden="true"></i> <a class="category-link" href="/categories/%E6%8A%80%E6%9C%AF%E7%9F%A5%E8%AF%86/">技术知识</a><span class="sep"></span><a class="category-link" href="/categories/%E6%8A%80%E6%9C%AF%E7%9F%A5%E8%AF%86/%E8%AE%A1%E7%AE%97%E6%9C%BA/">计算机</a></a></div><div class="new-meta-item date"><a class="notlink"><i class="fas fa-calendar-alt fa-fw" aria-hidden="true"></i><p>发布于：2021年3月4日</p></a></div><div class="new-meta-item browse leancloud"><a class="notlink"><div id="lc-pv" data-title="Linux学习笔记" data-path="/posts/2021/03/04/3d827be8af75/"><i class="fas fa-eye fa-fw" aria-hidden="true"></i><span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次浏览</div></a></div></div></div><span id="more"></span><h2 id="Linux的概述："><a class="header-anchor" href="#Linux的概述：">☀</a>Linux的概述：</h2><h3 id="学习Linux之前先了解Unix"><a class="header-anchor" href="#学习Linux之前先了解Unix">☀</a>学习Linux之前先了解Unix</h3><p>Unix是一个强大的多用户、多任务操作系统。于1969年在AT&amp;T的贝尔实验室开发。UNIX的商标权由国际开放标准组织（The Open Group）所拥有。UNIX操作系统是商业版，需要收费，价格比Microsoft Windows正版要贵一些。</p><h3 id="Linux的概述：-2"><a class="header-anchor" href="#Linux的概述：-2">☀</a>Linux的概述：</h3><p>Linux是基于Unix的</p><p>Linux是一种自由和开放源码的操作系统，存在着许多不同的Linux版本，但它们都使用了Linux内核。Linux可安装在各种计算机硬件设备中，比如手机、平板电脑、路由器、台式计算机</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210305091257.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210305091257.png" srcset="" alt="1"></p><p>诞生于1991 年10 月5 日。是由芬兰赫尔辛基大学学生Linus Torvalds和后来加入的众多爱好者共同开发完成</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224631.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224631.png" srcset="" alt="2"><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224710.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224710.png" srcset="" alt="image-20210304224710557"></p><h3 id="Linux的历史："><a class="header-anchor" href="#Linux的历史：">☀</a>Linux的历史：</h3><p>Linux最初是由芬兰赫尔辛基大学学生Linus Torvalds由于自己不满意教学中使用的MINIX操作系统， 所以在1990年底由于个人爱好设计出了LINUX系统核心。后来发布于芬兰最大的ftp服务器上，用户可以免费下载，所以它的周边的程序越来越多，Linux本身也逐渐发展壮大起来，之后Linux在不到三年的时间里成为了一个功能完善，稳定可靠的操作系统.</p><h3 id="Linux系统的应用："><a class="header-anchor" href="#Linux系统的应用：">☀</a>Linux系统的应用：</h3><p>服务器系统Web应用服务器、数据库服务器、接口服务器、DNS、FTP等等；</p><p>嵌入式系统路由器、防火墙、手机、PDA、IP 分享器、交换器、家电用品的微电脑控制器等等，</p><p>高性能运算、计算密集型应用Linux有强大的运算能力。</p><p>桌面应用系统</p><p>移动手持系统</p><h3 id="Linux的版本"><a class="header-anchor" href="#Linux的版本">☀</a>Linux的版本</h3><p>**Linux的版本分为两种：内核版本和发行版本；**内核版本是指在Linus领导下的内核小组开发维护的系统内核的版本号 ；</p><h3 id="Linux的主流版本"><a class="header-anchor" href="#Linux的主流版本">☀</a>Linux的主流版本</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224818.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/04/20210304224818.png" srcset="" alt="image-20210304224818581"></p><h2 id="Linux的安装："><a class="header-anchor" href="#Linux的安装：">☀</a>Linux的安装：</h2><h3 id="虚拟机安装："><a class="header-anchor" href="#虚拟机安装：">☀</a>虚拟机安装：</h3><h4 id="什么是虚拟机"><a class="header-anchor" href="#什么是虚拟机">☀</a>什么是虚拟机</h4><p>虚拟机：一台虚拟的电脑.</p><p>虚拟机软件:</p><ul><li><p>VmWare :收费的.</p></li><li><p>VirtualBox :免费的.</p></li></ul><h4 id="安装VmWare"><a class="header-anchor" href="#安装VmWare">☀</a>安装VmWare</h4><p>打开虚拟机软件，选择好盘符，傻瓜式下一步安装就可以。</p><h3 id="CentOS的安装"><a class="header-anchor" href="#CentOS的安装">☀</a>CentOS的安装</h3><p>参考Linux学习笔记-CentOS6安装</p><h3 id="Linux的远程访问"><a class="header-anchor" href="#Linux的远程访问">☀</a>Linux的远程访问</h3><h4 id="安装一个远程访问的软件-CRT"><a class="header-anchor" href="#安装一个远程访问的软件-CRT">☀</a>安装一个远程访问的软件:CRT</h4><h4 id="连接Linux"><a class="header-anchor" href="#连接Linux">☀</a>连接Linux:</h4><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305121650.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305121650.png" srcset="" alt="image-20210305121650130"></p><p>需要录入linux的ip地址及用户名密码.<br> 查看ip地址ifconfig.</p><h4 id="设置背景颜色-Linux风格。"><a class="header-anchor" href="#设置背景颜色-Linux风格。">☀</a>设置背景颜色,Linux风格。</h4><p>打开Options-&gt;Session Options-&gt;Emulation</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305121619.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305121619.png" srcset="" alt="image-20210305121619317"></p><h4 id="设置字体和编码格式"><a class="header-anchor" href="#设置字体和编码格式">☀</a>设置字体和编码格式</h4><p>打开Options-&gt;Session Options-&gt;Appearance</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305122127.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305122127.png" srcset="" alt="image-20210305122127389"></p><h2 id="Linux的目录结构："><a class="header-anchor" href="#Linux的目录结构：">☀</a>Linux的目录结构：</h2><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305142849.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305142849.png" srcset="" alt="image-20210305142849553"></p><p>root管理员的home目录root<br> 其他用户的home目录home目录中</p><h3 id="常用目录："><a class="header-anchor" href="#常用目录：">☀</a>常用目录：</h3><table><thead><tr><th>路径</th><th>作用</th></tr></thead><tbody><tr><td>/etc/init.d</td><td>存放服务启动项的各种脚本。<br><br>service命令依赖于此脚本。<img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210309213707.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210309213707.png" srcset="" alt="image-20210309203259736"></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><h2 id="Linux的常用命令"><a class="header-anchor" href="#Linux的常用命令">☀</a>Linux的常用命令</h2><h3 id="切换目录命令cd："><a class="header-anchor" href="#切换目录命令cd：">☀</a>切换目录命令cd：</h3><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>cd app</code></td><td>切换到app目录</td></tr><tr><td><code>cd ..</code></td><td>切换到上一层目录</td></tr><tr><td><code>cd /</code></td><td>切换到系统根目录</td></tr><tr><td><code>cd ~</code></td><td>切换到用户主目录</td></tr><tr><td><code>cd ~/abc</code></td><td>切换到用户主目录下的某个文件夹中。</td></tr><tr><td><code>cd -</code></td><td>切换到上一个所在目录</td></tr><tr><td><code>tab</code></td><td>补全文件路径</td></tr></tbody></table><h3 id="列出文件列表：ls-ll"><a class="header-anchor" href="#列出文件列表：ls-ll">☀</a>列出文件列表：ls ll</h3><p>ls(list)是一个非常有用的命令，用来显示当前目录下的内容。配合参数的使用，能以不同的方式显示目录内容。</p><p>格式：<code>ls\[参数\] \[路径或文件名\]</code></p><p>常用：</p><p>在linux中以 . 开头的文件都是隐藏的文件</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>ls</code></td><td>显示所有文件或目录</td></tr><tr><td><code>ls -a</code></td><td>显示所有文件或目录（包含隐藏的文件）</td></tr><tr><td><code>ls -l</code></td><td>缩写成ll,显示所有文件或目录(详细信息,大小,创建时间,权限等)</td></tr><tr><td><code>ls -l /etc</code></td><td>显示etc下的所有文件。</td></tr></tbody></table><h3 id="创建目录和移除目录：mkdir-rmdir"><a class="header-anchor" href="#创建目录和移除目录：mkdir-rmdir">☀</a>创建目录和移除目录：mkdir rmdir</h3><table><thead><tr><th><code>命令</code></th><th><code>描述</code></th></tr></thead><tbody><tr><td><code>mkdir(make directory)</code></td><td>mkdir app 在当前目录下创建</td></tr><tr><td><code>mkdir --p app2/test</code></td><td>级联创建aap2以及test目</td></tr><tr><td><code>rmdir(remove directory)</code></td><td>删除&quot;空&quot;的子目录：rmdir app 删除app目录</td></tr></tbody></table><h3 id="浏览文件"><a class="header-anchor" href="#浏览文件">☀</a>浏览文件</h3><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>cat</code></td><td>用于显示全部文件的内容。格式：cat[参数]&lt;文件名&gt;，内容太大受滚轮限制，显示不全。<br>cat 命令后，直接可以加全路径的文件名。这样可以实现跨包访问。</td></tr><tr><td><code>more</code></td><td>一般用于要显示的内容会超过一个画面长度的情况。<code>空格键</code>显示下一个画面。<code>回车</code>显示下一行内容。</td></tr><tr><td><code>less</code></td><td><code>less</code>用法和<code>more</code>类似，不同的是<code>less</code>可以通过<code>PgUp</code>、<code>PgDn</code>、<code>↑</code>、<code>↓</code>键来控制。。</td></tr><tr><td><code>q</code></td><td>退出<code>【cat、more、less】</code>查看。</td></tr><tr><td></td><td></td></tr><tr><td><code>tail</code></td><td>tail命令是在实际使用过程中使用非常多的一个命令，它的功能是：用于显示文件后几行的内容。</td></tr><tr><td><code>tail -10 /etc/passwd</code></td><td>查看后10行数据</td></tr><tr><td><code>tail -f catalina.log</code></td><td>动态查看日志(*****)</td></tr><tr><td><code>ctrl+c</code></td><td>结束<code>tail</code>查看</td></tr></tbody></table><h3 id="文件操作："><a class="header-anchor" href="#文件操作：">☀</a>文件操作：</h3><h4 id="【rm】删除"><a class="header-anchor" href="#【rm】删除">☀</a>【rm】删除</h4><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>rm</code></td><td>删除文件<br>用法：rm [选项]… 文件…<br>rm a.txt 删除a.txt文件<br>删除需要用户确认，y/nrm 删除不询问<br>但是不能删除文件夹。</td></tr><tr><td><code>rm -f a.txt</code></td><td>不询问，直接删除<code>rm</code> 删除目录</td></tr><tr><td><code>rm -r a</code></td><td>递归删除不询问递归删除（慎用）删除文件夹及文件。</td></tr><tr><td><code>rm -rf a</code></td><td>不询问递归删除</td></tr><tr><td><code>rm -rf *</code></td><td>删除当前目录下所有文件。(危险，慎用)</td></tr><tr><td><code>rm -rf /*</code></td><td>自杀,删除根目录下所有文件。</td></tr><tr><td></td><td></td></tr></tbody></table><h4 id="【cp、mv】复制"><a class="header-anchor" href="#【cp、mv】复制">☀</a>【cp、mv】复制</h4><p>cp(copy)命令可以将文件从一处复制到另一处。一般在使用cp命令时将一个文件复制成另一个文件或复制到某目录时，需要指定源文件名与目标文件名或目录。</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>cp a.txt b.txt</code></td><td>将a.txt复制为b.txt文件</td></tr><tr><td><code>cp b.tar.gz aa</code></td><td>复制文件并且重命名。</td></tr><tr><td><code>cp a.txt ../</code></td><td>将a.txt文件复制到上一层目录中<br>cp 复制文件到某个文件夹： 可以不带路径/</td></tr><tr><td><code>cp .../* aa</code></td><td>将某个路径文件夹下的所有文件复制到指定的文件夹中。</td></tr><tr><td><code>mv</code></td><td>移动或者重命名</td></tr><tr><td><code>mv a.txt ../</code></td><td>将a.txt文件移动到上一层目录中</td></tr><tr><td><code>mv a.txt b.txt</code></td><td>将a.txt文件重命名为b.txt</td></tr><tr><td><code>cp -r dir</code></td><td>复制整个目录.</td></tr></tbody></table><h4 id="【tar】命令-打包或解压"><a class="header-anchor" href="#【tar】命令-打包或解压">☀</a>【tar】命令:(***** 打包或解压)</h4><p>tar命令位于/bin目录下，它能够将用户所指定的文件或目录打包成一个文件，但不做压缩。一般Linux上常用的压缩方式是选用tar将许多文件打包成一个文件，再以gzip压缩命令压缩成xxx.tar.gz(或称为xxx.tgz)的文件。常用参数：</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>-c</code></td><td>创建一个新tar文件</td></tr><tr><td><code>-v</code></td><td>显示运行过程的信息</td></tr><tr><td><code>-f</code></td><td>指定文件名</td></tr><tr><td><code>-z</code></td><td>调用gzip压缩命令进行压缩</td></tr><tr><td><code>-t</code></td><td>查看压缩文件的内容</td></tr><tr><td><code>-x</code></td><td>解开tar文件</td></tr><tr><td><code>tar -cvf xxx.tar ./*</code></td><td>打包</td></tr><tr><td><code>tar -zcvf xxx.tar.gz ./*</code></td><td>打包并且压缩</td></tr><tr><td><code>tar -xvf xxx.tar</code><br><code>tar -zxvf xxx.tar.gz -C /usr/aaa</code><br><code>tar xf xxx.tar.gz</code></td><td>解压，三种解压方式都可以用。最后一种规避io，减小压力。</td></tr></tbody></table><h4 id="【find】命令"><a class="header-anchor" href="#【find】命令">☀</a>【find】命令</h4><p>find指令用于查找符合条件的文件</p><p>示例：</p><table><thead><tr><th><code>find / -name ins*</code><br><code>find / -name catal*.log</code></th><th><code>/</code> 表示从根目录查找<br>查找文件名称是以ins开头的文件</th></tr></thead><tbody><tr><td><code>find / -name ins*&quot; -ls</code></td><td><code>-ls</code> 显示查找到文件的详细信息。</td></tr><tr><td><code>find / -user itcast -ls</code></td><td>查找用户itcast的文件</td></tr><tr><td><code>find / -user itcast -type d -ls</code></td><td>查找用户itcast的目录</td></tr><tr><td><code>find / -perm -777 --type d -ls</code></td><td>查找权限是777的文件</td></tr></tbody></table><h4 id="【grep】命令"><a class="header-anchor" href="#【grep】命令">☀</a>【grep】命令</h4><p>查找文件里符合条件的字符串。</p><p>用法: grep [选项]… PATTERN [FILE]…示例：</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>grep lang anaconda-ks.cfg</code></td><td>在文件中查找lang</td></tr><tr><td><code>grep lang anaconda-ks.cfg --color</code></td><td>高亮显示</td></tr><tr><td><code>grep lang anaconda-ks.cfg --color -A1</code></td><td>after，<code>A1</code>显示，后一行。</td></tr><tr><td><code>grep lang anaconda-ks.cfg --color -A1 -B1</code></td><td>before,<code>B1</code>显示前一行。</td></tr></tbody></table><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162024.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162024.png" srcset="" alt="image-20210305162024476"><br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162040.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162040.png" srcset="" alt="image-20210305162040877"><br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162052.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/05/20210305162052.png" srcset="" alt="image-20210305162052182"></p><h3 id="其他常用命令"><a class="header-anchor" href="#其他常用命令">☀</a>其他常用命令</h3><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>pwd</code></td><td>显示当前所在目录</td></tr><tr><td><code>touch</code><br><code>touch a.txt</code></td><td>创建一个空文件</td></tr><tr><td><code>clear/ crtl + L</code></td><td>清屏</td></tr><tr><td><code>yum install 软件名称</code></td><td>安装软件</td></tr><tr><td><code>yum remove 软件名称</code></td><td>卸载软件</td></tr><tr><td><code>yum update 软件名称</code></td><td>更新软件</td></tr><tr><td><code>yum list</code></td><td>列出所有可安装的软件包</td></tr><tr><td><code>yum list updates</code></td><td>列出所有可更新的软件包</td></tr><tr><td><code>yum list installed</code></td><td>列出所有已安装的软件包</td></tr><tr><td><code>yum info updates</code></td><td>列出所有可更新的软件包信息</td></tr><tr><td><code>yum info installed</code></td><td>列出所有已安裝的软件包信息</td></tr><tr><td><code>yum search 软件包名称</code></td><td>查询yum库中可安装包版本信息的。</td></tr><tr><td><code>目录/可执行的文件</code>,例:<br><code>./nginx</code>,<code>/tomcat/bin/startup.sh</code></td><td>执行命令的时候需要带上<code>./</code>，<br>当前文件夹下的参数不需要。</td></tr><tr><td><code>chkconfig --list [name]</code></td><td>显示服务列表，和运行级别。</td></tr><tr><td><code>chkconfig --add [name]</code></td><td>添加服务，默认2，3，4，5，达到开机自启的效果，够用。</td></tr><tr><td><code>chkconfig --del [name]</code></td><td>删除服务。</td></tr><tr><td><code>chkconfig [--level levels] name &lt;on|off|reset&gt;</code></td><td>改变启动信息以及检查特定服务的启动状态</td></tr><tr><td><code>chkconfig 服务名 on</code></td><td>单独开启某一服务的命令</td></tr><tr><td><code>chkconfig 服务名 off</code></td><td>单独关闭某一服务的命令</td></tr><tr><td><code>/etc/intd.d/服务名 status</code></td><td>查看某一服务的状态</td></tr><tr><td><code>date</code></td><td>显示当前系统时间.</td></tr><tr><td><code>echo $var</code></td><td>显示当前进程中的变量。</td></tr><tr><td><code>echo $PATH</code></td><td>查看环境变量的某个值。</td></tr><tr><td><code>./test.sh &amp;</code></td><td>从后台执行脚本。</td></tr></tbody></table><h2 id="Vi和Vim编辑器"><a class="header-anchor" href="#Vi和Vim编辑器">☀</a>Vi和Vim编辑器</h2><h3 id="Vim编辑器："><a class="header-anchor" href="#Vim编辑器：">☀</a>Vim编辑器：</h3><p>在Linux下一般使用vi编辑器来编辑文件。vi既可以查看文件也可以编辑文件。三种模式：命令行、插入、底行模式。</p><p>💖<strong>vim时vi的升级版，功能支持更多，界面你显示更加友善，支持高亮。</strong>；</p><p>切换到命令行模式：按<code>Esc</code>键；</p><p>切换到插入模式：按 <code>i</code> 、<code>o</code>、<code>a</code>键；</p><p>切换到底行模式：按 <code>:</code>（冒号）；</p><p>打开文件：<code>vim file</code> ，如果打开的文件不存在，则会创建出文件。</p><p>退出：<code>esc :q</code></p><p>修改文件：输入<code>i</code>进入插入模式</p><p>保存并退出：<code>esc :wq</code></p><p>不保存退出：<code>esc:q!</code></p><p>基本命令：</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>i</code></td><td>在当前位置前插入</td></tr><tr><td><code>I</code></td><td>在当前行首插入</td></tr><tr><td><code>a</code></td><td>在当前位置后插入</td></tr><tr><td><code>A</code></td><td>在当前行尾插入</td></tr><tr><td><code>o</code></td><td>在当前行之后插入一行</td></tr><tr><td><code>O</code></td><td>在当前行之前插入一行</td></tr><tr><td><code>dd</code></td><td>快速删除一行</td></tr><tr><td><code>yy</code></td><td>复制当前行</td></tr><tr><td><code>nyy</code></td><td>从当前行向后复制几行</td></tr><tr><td><code>p</code></td><td>粘贴</td></tr><tr><td><code>R</code></td><td>替换</td></tr><tr><td><code>/查找内容</code></td><td>命令行模式搜索内容。</td></tr><tr><td></td><td></td></tr></tbody></table><p>更多详细用法，查询笔记，linux-vi</p><h3 id="重定向输出-和"><a class="header-anchor" href="#重定向输出-和">☀</a>重定向输出&gt;和&gt;&gt;</h3><p><code>&gt;</code> 重定向输出，覆盖原有内容；<code>&gt;&gt;</code> 重定向输出，又追加功能；示例：</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>cat /etc/passwd &gt; a.txt</code></td><td>将输出定向到a.txt中</td></tr><tr><td><code>cat /etc/passwd &gt;&gt; a.txt</code></td><td>输出并且追加</td></tr><tr><td><code>ifconfig &gt; ifconfig.txt</code></td><td>只要是控制台可以显示的信息，都可以重定向输出到指定的文件中。</td></tr></tbody></table><h3 id="系统管理命令"><a class="header-anchor" href="#系统管理命令">☀</a>系统管理命令</h3><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>ps</code></td><td>正在运行的某个进程的状态</td></tr><tr><td><code>ps -ef</code></td><td>查看所有进程</td></tr><tr><td><code>ps -ef | grep ssh</code></td><td>查找某一进程</td></tr><tr><td><code>kill 2868</code></td><td>杀掉2868编号的进程</td></tr><tr><td><code>kill -9 2868</code></td><td>强制杀死进程</td></tr><tr><td><code>kill -9 2868</code> 2869 2870`</td><td>强制杀死多个进程.</td></tr></tbody></table><h3 id="管道"><a class="header-anchor" href="#管道">☀</a>管道 |</h3><p>管道是Linux命令中重要的一个概念，<strong>其作用是将一个命令的输出用作另一个命令的输入</strong>。示例</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>ls --help | more</code></td><td>分页显示查询帮助信息</td></tr><tr><td><code>ps -ef | grep java</code></td><td>查询名称中包含java的进程</td></tr><tr><td><code>ifconfig | more</code></td><td>分页显示主机ip信息。</td></tr><tr><td><code>cat index.html | more</code></td><td>分页显示index.html，直接用<code>more</code>🤣</td></tr></tbody></table><p>管道深入理解：<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/04/08/image-20210408153613160.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/04/08/image-20210408153613160.png" srcset="" alt="image-20210408153613160"></p><p>管道的左右两边都会出发创建子进程。</p><h2 id="Linux的权限命令"><a class="header-anchor" href="#Linux的权限命令">☀</a>Linux的权限命令</h2><h3 id="文件权限"><a class="header-anchor" href="#文件权限">☀</a>文件权限</h3><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/07/20210313083624.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/07/20210313083624.png" srcset="" alt="image-20210307102148684"></p><hr><p><strong>属主（user）</strong> <strong>属组（group）</strong> <strong>其他用户</strong><br> r w x r w x r w x<br> 4 2 1 4 2 1 4 2 1</p><hr><p><code>r</code>:对文件是指可读取内容 对目录是可以ls</p><p><code>w</code>:对文件是指可修改文件内容，对目录 是指可以在其中创建或删除子节点(目录或文件)</p><p><code>x</code>:对文件是指是否可以运行这个文件，对目录是指是否可以cd进入这个目录</p><h3 id="Linux三种文件类型："><a class="header-anchor" href="#Linux三种文件类型：">☀</a>Linux三种文件类型：</h3><p>普通文件： 包括文本文件、数据文件、可执行的二进制程序文件等。</p><p>目录文件： Linux系统把目录看成是一种特殊的文件，利用它构成文件系统的树型结构。</p><p>设备文件： Linux系统把每一个设备都看成是一个文件</p><h3 id="文件类型标识"><a class="header-anchor" href="#文件类型标识">☀</a>文件类型标识</h3><p>普通文件（-）目录（d）符号链接（l）</p><blockquote><p>进入etc可以查看，相当于快捷方式字符设备文件（c）块设备文件（s）套接字（s）命名管道（p）</p></blockquote><h3 id="文件权限管理："><a class="header-anchor" href="#文件权限管理：">☀</a>文件权限管理：</h3><p><code>chmod</code> 变更文件或目录的权限。</p><table><thead><tr><th><code>命令</code></th><th><code>描述</code></th></tr></thead><tbody><tr><td><code>chmod u=rwx,g=rx,o=rx a.txt</code></td><td><code>u</code>当前用户权限，<code>g</code>当前用户组其他成员权限，<code>o</code>其他用户组成员权限。</td></tr><tr><td><code>chmod 755 a.txt</code></td><td>使用数字替换。4+2+1，4+1，4+1.</td></tr><tr><td><code>chmod +x xxx.sh</code></td><td>当前用户附加上可以执行权限。</td></tr></tbody></table><h2 id="Linux上常用网络操作"><a class="header-anchor" href="#Linux上常用网络操作">☀</a>Linux上常用网络操作</h2><h3 id="主机名配置"><a class="header-anchor" href="#主机名配置">☀</a>主机名配置</h3><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>hostname</code></td><td>查看主机名</td></tr><tr><td><code>hostname xxx</code></td><td>修改主机名 重启后无效</td></tr></tbody></table><p>✔<strong>如果想要永久生效，可以修改/etc/sysconfig/network文件。</strong></p><h2 id="IP地址配置"><a class="header-anchor" href="#IP地址配置">☀</a>IP地址配置</h2><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>ifconfig</code></td><td>查看(修改)ip地址(重启后无效)</td></tr><tr><td>ifconfig eth0 192.168.12.22</td><td>修改ip地址</td></tr></tbody></table><p>ipv4地址是自动自动分配的。如果想要永久生效。修改 &lt;<strong>/etc/sysconfig/network-scripts/ifcfg-eth0</strong>&gt;文件</p><figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">DEVICE</span>=<span class="string">eth0 #网卡名称</span></span><br><span class="line"><span class="attr">BOOTPROTO</span>=<span class="string">static #获取ip的方式(static/dhcp/bootp/none)</span></span><br><span class="line"><span class="attr">HWADDR</span>=<span class="string">00:0C:29:B5:B2:69 #MAC地址</span></span><br><span class="line"><span class="attr">IPADDR</span>=<span class="string">192.168.177.129 #IP地址</span></span><br><span class="line"><span class="attr">NETMASK</span>=<span class="string">255.255.255.0 #子网掩码</span></span><br><span class="line"><span class="attr">NETWORK</span>=<span class="string">192.168.177.0 #网络地址</span></span><br><span class="line"><span class="attr">BROADCAST</span>=<span class="string">192.168.0.255 #广播地址</span></span><br><span class="line"><span class="attr">NBOOT</span>=<span class="string">yes #系统启动时是否设置此网络接口，设置为yes时，系统启动时激活此设备。</span></span><br></pre></td></tr></table></figure><p>修改完后，重启Linux网络服务生效。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service network restart</span><br></pre></td></tr></table></figure><h2 id="域名映射"><a class="header-anchor" href="#域名映射">☀</a>域名映射</h2><p>&lt;/etc/hosts&gt;文件用于在通过主机名进行访问时做ip地址解析之用,相当于windows系统的&lt;C:\Windows\System32\drivers\etc\hosts文件的功能<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308103153.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308103153.png" srcset="" alt="image-20210308103152913"></p><h2 id="网络服务管理"><a class="header-anchor" href="#网络服务管理">☀</a>网络服务管理</h2><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>service network status</code></td><td>查看指定服务的状态</td></tr><tr><td><code>service network stop</code></td><td>停止指定服务</td></tr><tr><td><code>service network start</code></td><td>启动指定服务</td></tr><tr><td><code>service network restart</code></td><td>重启指定服务</td></tr><tr><td><code>service --status-all</code></td><td>查看系统中所有后台服务</td></tr><tr><td><code>netstat --nltp</code></td><td>查看系统中网络进程的端口监听情况</td></tr></tbody></table><p><strong>防火墙设置</strong></p><p>防火墙根据配置文件&lt;/etc/sysconfig/iptables&gt;来控制本机的&quot;出&quot;、&quot;入&quot;网络访问行为。</p><table><thead><tr><th>命令</th><th>描述</th></tr></thead><tbody><tr><td><code>service iptables status</code></td><td>查看防火墙状态</td></tr><tr><td><code>service iptables stop</code></td><td>关闭防火墙</td></tr><tr><td><code>service iptables start</code></td><td>启动防火墙</td></tr><tr><td><code>chkconfig iptables off</code></td><td>禁止防火墙自启</td></tr></tbody></table><h2 id="Linux上软件安装"><a class="header-anchor" href="#Linux上软件安装">☀</a>Linux上软件安装</h2><p>❤️编译就是将源码变成可执行文件。安装就是拷贝的过程。</p><ul><li>Linux上的软件安装有以下几种常见方式介绍</li></ul><ol><li>二进制发布包</li></ol><blockquote><p>软件已经针对具体平台编译打包发布，只要解压，修改配置即可</p></blockquote><ol start="2"><li>RPM包</li></ol><blockquote><p>软件已经按照redhat的包管理工具规范RPM进行打包发布，需要获取到相应的软件RPM发布包，然后用RPM命令进行安装</p></blockquote><ol start="3"><li>Yum在线安装</li></ol><blockquote><p>软件已经以RPM规范打包，但发布在了网络上的一些服务器上，可用yum在线安装服务器上的rpm软件，并且会自动解决软件安装过程中的库依赖问题</p></blockquote><ol start="4"><li>源码编译安装</li></ol><blockquote><p>软件以源码工程的形式发布，需要获取到源码工程后用相应开发工具进行编译打包部署。</p></blockquote><ul><li><h3 id="上传与下载工具介绍"><a class="header-anchor" href="#上传与下载工具介绍">☀</a>上传与下载工具介绍</h3></li></ul><ol><li><p>FileZilla<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308150704.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308150704.png" srcset="" alt="image-20210308150704773"><br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308150728.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308150728.png" srcset="" alt="image-20210308150728076"></p><p>显示文件名乱码解决方案：</p><p>解决方案：</p><p>1、filezilla连接上站点后，点击菜单栏的“文件”选项，下拉选择“添加当前连接到站点管理器”。</p><p>2、在弹出的“站点管理器”窗口中，左侧选择“新站点”，右侧切换到“字符集”选项卡后，勾选“使用自定义的字符集 ”并将编码设置为“gb2312”，或者选择”强制UTF-8″ ，两者编码选择其一，就能解决乱码问题</p></li><li><p>lrzsz</p></li></ol><blockquote><p>我们可以使用yum安装方式安装 <code>yum install lrzsz</code></p><p>注意：必须有网络</p><p>可以在crt中设置上传与下载目录<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153342.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153342.png" srcset="" alt="image-20210308153342080"></p><p>上传：<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153354.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153354.png" srcset="" alt="image-20210308153354092"></p><p>下载<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153405.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153405.png" srcset="" alt="image-20210308153405133"></p></blockquote><ol start="3"><li><p>sftp</p><blockquote><p>使用alt + p 组合键打开sftp窗口<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153555.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153555.png" srcset="" alt="image-20210308153555728"><br> 使用put 命令上传<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153613.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153613.png" srcset="" alt="image-20210308153612999"></p><p>😄小技巧：输入put命令后，进入电脑的某个目录，可以使用<code>tab</code>进行提示，需要上传哪个文件。<img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308163655.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308163655.png" srcset="" alt="image-20210308163654996"></p><p>使用get命令下载<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153642.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153642.png" srcset="" alt="image-20210308153642828"><br> 默认下载位置在当前计算的的文档位置<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153655.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308153655.png" srcset="" alt="image-20210308153655587"></p></blockquote></li></ol><h3 id="在Linux上安装JDK"><a class="header-anchor" href="#在Linux上安装JDK">☀</a>在Linux上安装JDK:</h3><p>检查系统的位数，下载对应的软件。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">getconf LONG_BIT</span><br></pre></td></tr></table></figure><p>【步骤一】：上传JDK到Linux的服务器.</p><p># 查看jdk版本</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java --version</span><br></pre></td></tr></table></figure><p># 查看安装的jdk信息</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa | grep java</span><br></pre></td></tr></table></figure><p># 卸载jdk，如果系统默认安装了， 卸载open-JDK</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rpm -e --nodeps java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.i686</span><br><span class="line">rpm -e --nodeps java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.i686</span><br></pre></td></tr></table></figure><p>#上传JDK，通过sftp快速本地上传。</p><p>【步骤二】：在Linux服务器上安装JDK.</p><p>* 通常将软件安装到/usr/local</p><p>* 直接解压就可以</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar --xvf jdk.tar.gz -C 目标路径</span><br></pre></td></tr></table></figure><p>【步骤三】：配置JDK的环境变量.</p><p>配置环境变量：</p><p>①</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/profile</span><br></pre></td></tr></table></figure><p>② 在末尾行添加</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#set java environment</span></span><br><span class="line">JAVA_HOME=/usr/local/jdk/jdk1.7.0_71</span><br><span class="line">CLASSPATH=.:<span class="variable">$JAVA_HOME</span>/lib.tools.jar</span><br><span class="line">PATH=<span class="variable">$JAVA_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line"><span class="built_in">export</span> JAVA_HOME CLASSPATH PATH</span><br></pre></td></tr></table></figure><p>保存退出</p><p>③ 使更改的配置立即生效</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure><h3 id="在Linux上使用Mysql"><a class="header-anchor" href="#在Linux上使用Mysql">☀</a>在Linux上使用Mysql:</h3><h4 id="安装"><a class="header-anchor" href="#安装">☀</a>安装</h4><h5 id="【步骤一】：将mysql的安装文件上传到Linux的服务器"><a class="header-anchor" href="#【步骤一】：将mysql的安装文件上传到Linux的服务器">☀</a>【步骤一】：将mysql的安装文件上传到Linux的服务器.</h5><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173452.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173452.png" srcset="" alt="image-20210308173452718"></p><p>将mysql的tar解压<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173511.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173511.png" srcset="" alt="image-20210308173511180"></p><p>将系统自带的mysql卸载，详细卸载步骤，请看下方。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa|grep -i mysql</span><br></pre></td></tr></table></figure><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173613.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308173613.png" srcset="" alt="image-20210308173539545"></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps</span><br></pre></td></tr></table></figure><h5 id="【步骤二】：安装MYSQL服务端"><a class="header-anchor" href="#【步骤二】：安装MYSQL服务端">☀</a>【步骤二】：安装MYSQL服务端</h5><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308185803.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308185803.png" srcset="" alt="image-20210308185802946"></p><p>可能会出现的错误信息:</p><ol><li>MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308185835.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308185835.png" srcset="" alt="image-20210308185835160"></li></ol><p>**解决办法:**删除冲突的包</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y remove mariadb-libs-1:5.5.68-1.el7.x86_64</span><br></pre></td></tr></table></figure><ol start="2"><li><p>FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308190046.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308190046.png" srcset="" alt="image-20210308190046142"><br> **解决方法 ：**安装autoconf库</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y install autoconf</span><br></pre></td></tr></table></figure></li></ol><p>下面的提示是告诉我们root用户的密码第一次是随机生成的，它保存在/root/.mysql_secret中，第一次登录需要修改root密码<img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193024.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193024.png" srcset="" alt="image-20210308193023928"></p><h5 id="【步骤三】：安装MYSQL客户端"><a class="header-anchor" href="#【步骤三】：安装MYSQL客户端">☀</a>【步骤三】：安装MYSQL客户端</h5><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193035.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193035.png" srcset="" alt="image-20210308193035055"></p><p>查看生成的root密码<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193047.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193047.png" srcset="" alt="image-20210308193047073"></p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193059.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193059.png" srcset="" alt="image-20210308193059310"><br> 报错:原因是没有启动mysql服务</p><h5 id="【步骤四】：开启MYSQL服务"><a class="header-anchor" href="#【步骤四】：开启MYSQL服务">☀</a>【步骤四】：开启MYSQL服务</h5><p>需要开启mysql服务<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193117.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193117.png" srcset="" alt="image-20210308193117029"></p><p>centos6命令：<code>service mysql start</code></p><p>centos7命令：<code>systemctl start mysql</code></p><p>可能会出现的错误信息:</p><ol><li><p>Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308191842.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308191842.png" srcset="" alt="image-20210308191842844"><br> **解决方案:**执行命令</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/usr/bin/mysql_install_db --user=mysql</span><br></pre></td></tr></table></figure><p>注意执行,此命令后会生成mysql的<u>初始密码</u>。<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193010.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193010.png" srcset="" alt="image-20210308193010533"></p><p>登陆后修改mysql的root用户密码：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">mysql -u root -pnew-password</span><br><span class="line">mysql&gt; use mysql;</span><br><span class="line">mysql&gt; UPDATE user SET password = PASSWORD(<span class="string">&#x27;新密码&#x27;</span>) WHERE user = <span class="string">&#x27;root&#x27;</span>;</span><br><span class="line">mysql&gt; FLUSH PRIVILEGES;</span><br></pre></td></tr></table></figure></li><li><p>执行命令<code>show databases;</code>报错，原因是第一次操作mysql必须修改root用户的密码<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193126.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193126.png" srcset="" alt="image-20210308193126548"></p><p>设置root用户的密码<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193139.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308193139.png" srcset="" alt="image-20210308193139313"></p></li></ol><h5 id="【步骤五】：关于mysql远程访问设置"><a class="header-anchor" href="#【步骤五】：关于mysql远程访问设置">☀</a>【步骤五】：关于mysql远程访问设置</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">grant all privileges on *.* to <span class="string">&#x27;root&#x27;</span> @<span class="string">&#x27;%&#x27;</span> identified by <span class="string">&#x27;root&#x27;</span>;</span><br><span class="line">flush privileges;</span><br></pre></td></tr></table></figure><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308194313.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308194313.png" srcset="" alt="image-20210308194313380"></p><p>在linux中很多软件的端口都被&quot;防火墙&quot;限止，我们需要将防火墙关闭</p><p>防火墙打开3306端口</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">/sbin/iptables -I INPUT -p tcp \--dport 3306 -j ACCEPT</span><br><span class="line">/etc/rc.d/init.d/iptables save</span><br><span class="line">/etc/init.d/iptables status</span><br></pre></td></tr></table></figure><p>学习阶段我们也可以直接将防火墙关闭</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">service iptables stop;  <span class="comment">#Centos6</span></span><br><span class="line"></span><br><span class="line">systemctl stop firewalld; <span class="comment">#Centos7</span></span><br></pre></td></tr></table></figure><h5 id="【步骤六】：Mysql服务加入到系统服务并自动启动操作："><a class="header-anchor" href="#【步骤六】：Mysql服务加入到系统服务并自动启动操作：">☀</a><strong>【步骤六】：Mysql服务加入到系统服务并自动启动操作：</strong></h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">添加自动启动配置：</span><br><span class="line">chkconfig --add mysql</span><br><span class="line">启动：</span><br><span class="line">chkconfig mysql on</span><br><span class="line">查询列表：</span><br><span class="line">chkconfig</span><br></pre></td></tr></table></figure><h4 id="卸载"><a class="header-anchor" href="#卸载">☀</a>卸载</h4><h5 id="一、使用以下命令查看当前安装mysql情况，查找以前是否装有mysql"><a class="header-anchor" href="#一、使用以下命令查看当前安装mysql情况，查找以前是否装有mysql">☀</a><strong>一、使用以下命令查看当前安装mysql情况，查找以前是否装有mysql</strong></h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa| <span class="string">&#x27;grep&#x27;</span> -i mysql</span><br></pre></td></tr></table></figure><p>可以看到如下图的所示：<br> <img src="http://files.jb51.net/file_images/article/201611/2016111793322836.jpg?2016101793335" class="lazyload" data-srcset="http://files.jb51.net/file_images/article/201611/2016111793322836.jpg?2016101793335" srcset="" alt="img"></p><p>显示之前安装了：</p><p>MySQL-client-5.5.25a-1.rhel5</p><p>MySQL-server-5.5.25a-1.rhel5</p><h5 id="2、停止mysql服务、删除之前安装的mysql"><a class="header-anchor" href="#2、停止mysql服务、删除之前安装的mysql">☀</a><strong>2、停止mysql服务、删除之前安装的mysql</strong></h5><p>删除命令：<code>rpm -e –nodeps 包名</code></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rpm -ev MySQL-client-5.5.25a-1.rhel5</span><br><span class="line">rpm -ev MySQL-server-5.5.25a-1.rhel5</span><br></pre></td></tr></table></figure><p>如果提示依赖包错误，则使用以下命令尝试</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps</span><br></pre></td></tr></table></figure><p>如果提示错误：<code>error: %preun(xxxxxx) scriptlet failed, exit status 1</code></p><p>则用以下命令尝试：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5</span><br></pre></td></tr></table></figure><h5 id="3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库"><a class="header-anchor" href="#3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库">☀</a><strong>3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库</strong></h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find / -name mysql</span><br></pre></td></tr></table></figure><p>查找结果如下：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">find / -name mysql</span><br><span class="line"><span class="comment">#结果</span></span><br><span class="line">/var/lib/mysql</span><br><span class="line">/var/lib/mysql/mysql</span><br><span class="line">/usr/lib64/mysql</span><br></pre></td></tr></table></figure><p>删除对应的mysql目录</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">rm</span> -rf /var/lib/mysql</span><br><span class="line"><span class="built_in">rm</span> -rf /var/lib/mysql</span><br><span class="line"><span class="built_in">rm</span> -rf /usr/lib64/mysql</span><br></pre></td></tr></table></figure><p>具体的步骤如图：查找目录并删除<br> <img src="http://files.jb51.net/file_images/article/201611/2016111793651688.jpg?201610179371" class="lazyload" data-srcset="http://files.jb51.net/file_images/article/201611/2016111793651688.jpg?201610179371" srcset="" alt="img"></p><p>**注意：**卸载后/etc/my.cnf不会删除，需要进行手工删除</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">rm</span> -rf /etc/my.cnf</span><br></pre></td></tr></table></figure><h5 id="4、再次查找机器是否安装mysql"><a class="header-anchor" href="#4、再次查找机器是否安装mysql">☀</a><strong>4、再次查找机器是否安装mysql</strong></h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa| grep -i mysql</span><br></pre></td></tr></table></figure><h4 id="配置mysql默认编码格式"><a class="header-anchor" href="#配置mysql默认编码格式">☀</a>配置mysql默认编码格式</h4><p>安装完成后，mysql数据库的默认编码是<code>latin1</code>，可以使用下面代码查看数据库编码。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">show variables like <span class="string">&quot;%character%&quot;</span>;</span><br></pre></td></tr></table></figure><p>默认的<code>latin1</code>编码，会导致无法插入中文。</p><p>需要修改mysql的配置文件,并且重启mysql服务：</p><p>1.查找mysql配置文件位置：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find / -name my.cnf</span><br></pre></td></tr></table></figure><p>2.找到后，使用vim修改。添加内容具体如下：</p><figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">[client]</span></span><br><span class="line"><span class="attr">default-character-set</span> = <span class="string">utf8</span></span><br><span class="line"><span class="attr">[mysqld]</span></span><br><span class="line"><span class="attr">character-set-server</span> = <span class="string">utf8</span></span><br><span class="line"><span class="attr">[mysql]</span></span><br><span class="line"><span class="attr">default-character-set</span> = <span class="string">utf8</span></span><br><span class="line"><span class="attr">[mysql.server]</span></span><br><span class="line"><span class="attr">default-character-set</span> = <span class="string">utf8</span></span><br><span class="line"><span class="attr">[mysqld_safe]</span></span><br><span class="line"><span class="attr">default-character-set</span> = <span class="string">utf8</span></span><br></pre></td></tr></table></figure><p>3.重启mysql服务</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl restart mysql</span><br></pre></td></tr></table></figure><blockquote><p>经过上面的修改后，以后数据库创建的表默认的编码都是utf8，可以插入中文了，但是在修改编码前已经创建的表和库编码还是latin1，还是不能插入中文，有两种解决办法：<br> 1.第一种方法：最直接明了，删表重建。<br> 2.第二种方法：使用下面语句，tablename换成你的表名，该语句的作用就是把表的编码换成utf8<br> <code>alter table tablename convert to character set utf8;</code><br> 3.在已经创建的默认latin1编码的库中，创建新表默认还会是latin1，所以，删除库或者修改库的默认编码。</p></blockquote><h3 id="在Linux上安装tomcat"><a class="header-anchor" href="#在Linux上安装tomcat">☀</a>在Linux上安装tomcat</h3><p>1.Tomcat上传到linux上</p><p>2.将上传的tomcat解压</p><p>3.在tomcat/bin目录下执行 <a target="_blank" rel="noopener external nofollow noreferrer" href="http://startup.sh">startup.sh</a>（注意防火墙）</p><p>4.查看目标 tomcat/logs/catalina.out</p><h3 id="在Linux上安装redis"><a class="header-anchor" href="#在Linux上安装redis">☀</a>在Linux上安装redis</h3><p>【步骤一】安装gcc-c++</p><blockquote><p>redis是C语言开发，安装redis需要先将官网下载的源码进行编译，编译依赖gcc环境。</p><p>输入命令:</p><p><code>yum -y install gcc-c++</code><br> ✔️<code>yum install gcc</code><br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213718.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213718.png" srcset="" alt="image-20210308213718449"></p><p>查看gcc版本</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">gcc -v</span><br></pre></td></tr></table></figure></blockquote><p>安装命令没有带<code>y</code>参数，输入y确认下载<br> <img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213830.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213830.png" srcset="" alt="image-20210308213830164"></p><p>输入y确认安装</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213851.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213851.png" srcset="" alt="image-20210308213850989"></p><p>安装 gcc 成功！</p><p><img src="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213915.png" class="lazyload" data-srcset="https://yefeit-note-picbed.oss-cn-shanghai.aliyuncs.com/blog/2021/03/08/20210308213915.png" srcset="" alt="image-20210308213915102"></p><p>【步骤二】安装redis</p><ol><li>下载redis</li></ol><blockquote><p>wget <a target="_blank" rel="noopener external nofollow noreferrer" href="http://download.redis.io/releases/redis-3.0.4.tar.gz">http://download.redis.io/releases/redis-3.0.4.tar.gz</a></p></blockquote><ol start="2"><li>解压</li></ol><blockquote><p>tar -xzvf redis-3.0.4.tar.gz</p></blockquote><ol start="3"><li>编译安装、</li></ol><blockquote><p>切换至程序目录，并执行make命令编译：</p><p>cd redis-3.0.4</p><p>执行安装命令make</p></blockquote><p>make时出现如下错误，redis版本6太高，安装5即可。</p><p>make[1]: *** [server.o] 错误 1</p><blockquote><p>make PREFIX=/usr/local/redis install</p><p>make install安装完成后，会在/usr/local/redis/bin目录下生成下面几个可执行文件，它们的作用分别是：</p><p>redis-server：Redis服务器端启动程序</p><p>redis-cli：Redis客户端操作工具。也可以用telnet根据其纯文本协议来操作</p><p>redis-benchmark：Redis性能测试工具</p><p>redis-check-aof：数据修复工具</p><p>redis-check-dump：检查导出工具</p></blockquote><p>【步骤三】配置redis</p><ol><li>复制配置文件到/usr/local/redis/bin目录：</li></ol><blockquote><p>cd redis-3.0.4</p><p>cp redis.conf /usr/local/redis/bin</p></blockquote><p>【步骤四】测试启动redis</p><ol><li>进入redis/bin目录</li></ol><blockquote><p>cd redis/bin</p><p>启动redis服务端</p><p>./redis-server redis.conf</p></blockquote><ol start="2"><li>克隆新窗口，启动redis客户端</li></ol><blockquote><p>./redis-cli</p></blockquote><p>【步骤五】 配置添加redis客户端和服务端程序的环境变量。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/profile</span><br><span class="line">REDIS_HOME=/usr/local/redis</span><br><span class="line">PATH=<span class="variable">$REDIS_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line"><span class="built_in">export</span> REDIS_HOME PATH</span><br></pre></td></tr></table></figure><p>【步骤六】进入util目录执行服务安装脚本。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> utils</span><br><span class="line">./install_server.sh</span><br></pre></td></tr></table></figure><p>安装过程中，配置好端口名，其他使用默认即可。</p><p>【步骤七】检查已安装好的服务启动脚本。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /etc/init.d/</span><br></pre></td></tr></table></figure><div class="footer"><div class="copyright"><blockquote><p>博客内容遵循 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</p><p>本文永久链接是：<a href="http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/">http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/</a></p></blockquote></div></div><div class="article-meta" id="bottom"><div class="new-meta-box"><div class="new-meta-item date" itemprop="dateUpdated" datetime="2021-03-04T21:33:33+08:00"><a class="notlink"><i class="fas fa-edit fa-fw" aria-hidden="true"></i><p>更新于：2021年3月4日</p></a></div><div class="new-meta-item meta-tags"><a class="tag" href="/tags/Linux/" rel="nofollow"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i><p>Linux</p></a></div><div class="new-meta-item share -mob-share-list"><div class="-mob-share-list share-body"> <a class="-mob-share-qq" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/&title=Linux学习笔记 - Tang's blog.&summary="><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qq.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qq.png" srcset=""></a> <a class="-mob-share-qzone" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/&title=Linux学习笔记 - Tang's blog.&summary="><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qzone.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qzone.png" srcset=""></a> <a class="-mob-share-weibo" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="http://service.weibo.com/share/share.php?url=http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/&title=Linux学习笔记 - Tang's blog.&summary="><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/weibo.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/weibo.png" srcset=""></a><div class="hoverbox"> <a class="share"><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/wechat.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/wechat.png" srcset=""></a><div class="target"> <img src=""></div></div> <a class="-mob-share-telegram" title="" rel="external nofollow noopener noreferrer noopener" target="_blank" href="https://t.me/share/url?url=http://aner1001.gitee.io/posts/2021/03/04/3d827be8af75/&text=Linux学习笔记 - Tang's blog."><img src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/telegram.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/telegram.png" srcset=""></a></div></div></div></div><div class="prev-next"><a class="prev" href="/posts/2021/03/05/bc95e0b1ed74/"><p class="title"><i class="fas fa-chevron-left" aria-hidden="true"></i>家具选购经验</p><p class="content"> 超过3000块的沙发不要去宜家买，都是喜乐门代工的。 北欧表情 宫御家具 北欧家居 样子生活 Mini More 吱音 涵客家居 北欧印象 青木堂 格度 沙发不是越贵越好.看坐感和坐姿.贵...</p></a><a class="next" href="/posts/2021/03/04/e55aa0d7a71b/"><p class="title">Git学习笔记<i class="fas fa-chevron-right" aria-hidden="true"></i></p><p class="content">Git工具学习笔记。主要参考了廖雪峰老师的学习网站。 注：本文中如果使用了,，&lt;&gt;这些标签为了好的区分和显示效果才加上。实际写命令时不需要带上&lt;&gt;,直接写里面的名称内...</p></a></div></article><article class="post white-box reveal shadow" id="comments"><p ct><i class="fas fa-comments"></i> 评论</p><div id="valine_container" class="valine_thread"><i class="fas fa-cog fa-spin fa-fw fa-2x"></i></div></article></div><aside class="l_side"><section class="widget list group shadow desktop mobile"><header><a target="_blank" rel="noopener external nofollow noreferrer" href="https://linux.cn/"><i class="fab fa-github fa-fw" aria-hidden="true"></i> <span class="name">Linux</span></a></header><div class="content"><ul class="list entry navigation"><li><a class="flat-box" title="/posts/2021/02/08/8fb759bdc2c9/" href="/posts/2021/02/08/8fb759bdc2c9/" id="posts202102088fb759bdc2c9"><div class="name"> linux-vi</div></a></li><li><a class="flat-box" title="/posts/2021/03/04/3d827be8af75/" href="/posts/2021/03/04/3d827be8af75/" id="posts202103043d827be8af75"><div class="name"> Linux学习笔记</div></a></li><li><a class="flat-box" title="/posts/2021/03/05/1c9a43ac0b33/" href="/posts/2021/03/05/1c9a43ac0b33/" id="posts202103051c9a43ac0b33"><div class="name"> Linux学习笔记2-CentOS安装文档</div></a></li></ul></div></section><section class="widget toc-wrapper shadow desktop mobile" id="toc-div"><header><i class="fas fa-list fa-fw" aria-hidden="true"></i> <span class="name">本文目录</span></header><div class="content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E7%9A%84%E6%A6%82%E8%BF%B0%EF%BC%9A"><span class="toc-text">Linux的概述：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AD%A6%E4%B9%A0Linux%E4%B9%8B%E5%89%8D%E5%85%88%E4%BA%86%E8%A7%A3Unix"><span class="toc-text">学习Linux之前先了解Unix</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%9A%84%E6%A6%82%E8%BF%B0%EF%BC%9A-2"><span class="toc-text">Linux的概述：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%9A%84%E5%8E%86%E5%8F%B2%EF%BC%9A"><span class="toc-text">Linux的历史：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%B3%BB%E7%BB%9F%E7%9A%84%E5%BA%94%E7%94%A8%EF%BC%9A"><span class="toc-text">Linux系统的应用：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%9A%84%E7%89%88%E6%9C%AC"><span class="toc-text">Linux的版本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%9A%84%E4%B8%BB%E6%B5%81%E7%89%88%E6%9C%AC"><span class="toc-text">Linux的主流版本</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E7%9A%84%E5%AE%89%E8%A3%85%EF%BC%9A"><span class="toc-text">Linux的安装：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%99%9A%E6%8B%9F%E6%9C%BA%E5%AE%89%E8%A3%85%EF%BC%9A"><span class="toc-text">虚拟机安装：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AF%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-text">什么是虚拟机</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85VmWare"><span class="toc-text">安装VmWare</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#CentOS%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">CentOS的安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%9A%84%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE"><span class="toc-text">Linux的远程访问</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E4%B8%80%E4%B8%AA%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE%E7%9A%84%E8%BD%AF%E4%BB%B6-CRT"><span class="toc-text">安装一个远程访问的软件:CRT</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9E%E6%8E%A5Linux"><span class="toc-text">连接Linux:</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E8%83%8C%E6%99%AF%E9%A2%9C%E8%89%B2-Linux%E9%A3%8E%E6%A0%BC%E3%80%82"><span class="toc-text">设置背景颜色,Linux风格。</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%AD%97%E4%BD%93%E5%92%8C%E7%BC%96%E7%A0%81%E6%A0%BC%E5%BC%8F"><span class="toc-text">设置字体和编码格式</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E7%9A%84%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84%EF%BC%9A"><span class="toc-text">Linux的目录结构：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E7%9B%AE%E5%BD%95%EF%BC%9A"><span class="toc-text">常用目录：</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E7%9A%84%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-text">Linux的常用命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%87%E6%8D%A2%E7%9B%AE%E5%BD%95%E5%91%BD%E4%BB%A4cd%EF%BC%9A"><span class="toc-text">切换目录命令cd：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%97%E5%87%BA%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8%EF%BC%9Als-ll"><span class="toc-text">列出文件列表：ls ll</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E7%9B%AE%E5%BD%95%E5%92%8C%E7%A7%BB%E9%99%A4%E7%9B%AE%E5%BD%95%EF%BC%9Amkdir-rmdir"><span class="toc-text">创建目录和移除目录：mkdir rmdir</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8F%E8%A7%88%E6%96%87%E4%BB%B6"><span class="toc-text">浏览文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E6%93%8D%E4%BD%9C%EF%BC%9A"><span class="toc-text">文件操作：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E3%80%90rm%E3%80%91%E5%88%A0%E9%99%A4"><span class="toc-text">【rm】删除</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E3%80%90cp%E3%80%81mv%E3%80%91%E5%A4%8D%E5%88%B6"><span class="toc-text">【cp、mv】复制</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E3%80%90tar%E3%80%91%E5%91%BD%E4%BB%A4-%E6%89%93%E5%8C%85%E6%88%96%E8%A7%A3%E5%8E%8B"><span class="toc-text">【tar】命令:(***** 打包或解压)</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E3%80%90find%E3%80%91%E5%91%BD%E4%BB%A4"><span class="toc-text">【find】命令</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E3%80%90grep%E3%80%91%E5%91%BD%E4%BB%A4"><span class="toc-text">【grep】命令</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%B6%E4%BB%96%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-text">其他常用命令</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Vi%E5%92%8CVim%E7%BC%96%E8%BE%91%E5%99%A8"><span class="toc-text">Vi和Vim编辑器</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Vim%E7%BC%96%E8%BE%91%E5%99%A8%EF%BC%9A"><span class="toc-text">Vim编辑器：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%87%8D%E5%AE%9A%E5%90%91%E8%BE%93%E5%87%BA-%E5%92%8C"><span class="toc-text">重定向输出&gt;和&gt;&gt;</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86%E5%91%BD%E4%BB%A4"><span class="toc-text">系统管理命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AE%A1%E9%81%93"><span class="toc-text">管道 |</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E7%9A%84%E6%9D%83%E9%99%90%E5%91%BD%E4%BB%A4"><span class="toc-text">Linux的权限命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E6%9D%83%E9%99%90"><span class="toc-text">文件权限</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E4%B8%89%E7%A7%8D%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B%EF%BC%9A"><span class="toc-text">Linux三种文件类型：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B%E6%A0%87%E8%AF%86"><span class="toc-text">文件类型标识</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86%EF%BC%9A"><span class="toc-text">文件权限管理：</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E4%B8%8A%E5%B8%B8%E7%94%A8%E7%BD%91%E7%BB%9C%E6%93%8D%E4%BD%9C"><span class="toc-text">Linux上常用网络操作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%BB%E6%9C%BA%E5%90%8D%E9%85%8D%E7%BD%AE"><span class="toc-text">主机名配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IP%E5%9C%B0%E5%9D%80%E9%85%8D%E7%BD%AE"><span class="toc-text">IP地址配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%9F%E5%90%8D%E6%98%A0%E5%B0%84"><span class="toc-text">域名映射</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BD%91%E7%BB%9C%E6%9C%8D%E5%8A%A1%E7%AE%A1%E7%90%86"><span class="toc-text">网络服务管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E4%B8%8A%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85"><span class="toc-text">Linux上软件安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8A%E4%BC%A0%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%B7%A5%E5%85%B7%E4%BB%8B%E7%BB%8D"><span class="toc-text">上传与下载工具介绍</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8Linux%E4%B8%8A%E5%AE%89%E8%A3%85JDK"><span class="toc-text">在Linux上安装JDK:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8Linux%E4%B8%8A%E4%BD%BF%E7%94%A8Mysql"><span class="toc-text">在Linux上使用Mysql:</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85"><span class="toc-text">安装</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E4%B8%80%E3%80%91%EF%BC%9A%E5%B0%86mysql%E7%9A%84%E5%AE%89%E8%A3%85%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E5%88%B0Linux%E7%9A%84%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-text">【步骤一】：将mysql的安装文件上传到Linux的服务器.</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E4%BA%8C%E3%80%91%EF%BC%9A%E5%AE%89%E8%A3%85MYSQL%E6%9C%8D%E5%8A%A1%E7%AB%AF"><span class="toc-text">【步骤二】：安装MYSQL服务端</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E4%B8%89%E3%80%91%EF%BC%9A%E5%AE%89%E8%A3%85MYSQL%E5%AE%A2%E6%88%B7%E7%AB%AF"><span class="toc-text">【步骤三】：安装MYSQL客户端</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E5%9B%9B%E3%80%91%EF%BC%9A%E5%BC%80%E5%90%AFMYSQL%E6%9C%8D%E5%8A%A1"><span class="toc-text">【步骤四】：开启MYSQL服务</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E4%BA%94%E3%80%91%EF%BC%9A%E5%85%B3%E4%BA%8Emysql%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE%E8%AE%BE%E7%BD%AE"><span class="toc-text">【步骤五】：关于mysql远程访问设置</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E3%80%90%E6%AD%A5%E9%AA%A4%E5%85%AD%E3%80%91%EF%BC%9AMysql%E6%9C%8D%E5%8A%A1%E5%8A%A0%E5%85%A5%E5%88%B0%E7%B3%BB%E7%BB%9F%E6%9C%8D%E5%8A%A1%E5%B9%B6%E8%87%AA%E5%8A%A8%E5%90%AF%E5%8A%A8%E6%93%8D%E4%BD%9C%EF%BC%9A"><span class="toc-text">【步骤六】：Mysql服务加入到系统服务并自动启动操作：</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8D%B8%E8%BD%BD"><span class="toc-text">卸载</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E4%BD%BF%E7%94%A8%E4%BB%A5%E4%B8%8B%E5%91%BD%E4%BB%A4%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E5%AE%89%E8%A3%85mysql%E6%83%85%E5%86%B5%EF%BC%8C%E6%9F%A5%E6%89%BE%E4%BB%A5%E5%89%8D%E6%98%AF%E5%90%A6%E8%A3%85%E6%9C%89mysql"><span class="toc-text">一、使用以下命令查看当前安装mysql情况，查找以前是否装有mysql</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2%E3%80%81%E5%81%9C%E6%AD%A2mysql%E6%9C%8D%E5%8A%A1%E3%80%81%E5%88%A0%E9%99%A4%E4%B9%8B%E5%89%8D%E5%AE%89%E8%A3%85%E7%9A%84mysql"><span class="toc-text">2、停止mysql服务、删除之前安装的mysql</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3%E3%80%81%E6%9F%A5%E6%89%BE%E4%B9%8B%E5%89%8D%E8%80%81%E7%89%88%E6%9C%ACmysql%E7%9A%84%E7%9B%AE%E5%BD%95%E3%80%81%E5%B9%B6%E4%B8%94%E5%88%A0%E9%99%A4%E8%80%81%E7%89%88%E6%9C%ACmysql%E7%9A%84%E6%96%87%E4%BB%B6%E5%92%8C%E5%BA%93"><span class="toc-text">3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#4%E3%80%81%E5%86%8D%E6%AC%A1%E6%9F%A5%E6%89%BE%E6%9C%BA%E5%99%A8%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85mysql"><span class="toc-text">4、再次查找机器是否安装mysql</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEmysql%E9%BB%98%E8%AE%A4%E7%BC%96%E7%A0%81%E6%A0%BC%E5%BC%8F"><span class="toc-text">配置mysql默认编码格式</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8Linux%E4%B8%8A%E5%AE%89%E8%A3%85tomcat"><span class="toc-text">在Linux上安装tomcat</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8Linux%E4%B8%8A%E5%AE%89%E8%A3%85redis"><span class="toc-text">在Linux上安装redis</span></a></li></ol></li></ol></div></section></aside><script>window.pdata={},pdata.ispage=!0,pdata.postTitle="Linux学习笔记",pdata.commentPath="",pdata.commentPlaceholder="";var l_header=document.getElementById("l_header");l_header.classList.add("show");var cover_wrapper=document.querySelector(".cover-wrapper");cover_wrapper.id="none",cover_wrapper.style.display="none"</script></div><footer class="footer clearfix"><br><br><div class="aplayer-container"><meting-js theme="#1BCDFC" autoplay="false" volume="0.7" loop="all" order="list" fixed="false" list-max-height="320px" server="netease" type="playlist" id="5472211102" list-folded="true"></meting-js></div><br><div class="social-wrapper"><a href="/atom.xml" class="social fas fa-rss flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="mailto:584856024@qq.com" class="social fas fa-envelope flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="https://github.com/aner1001" class="social fab fa-github flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a><a href="https://music.163.com/#/user/home?id=1402271985" class="social fas fa-headphones-alt flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a></div><div><p>博客内容遵循 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p></div><div><p><span id="lc-sv">本站总访问量为<span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次</span> <span id="lc-uv">访客数为<span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 人</span></p></div> 本站使用 <a href="https://github.com/volantis-x/hexo-theme-volantis/tree/4.3.1" rel="external nofollow noreferrer" target="_blank" class="codename">Volantis</a> 作为主题，总访问量为<span id="busuanzi_value_site_pv"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次<div class="copyright"><p><a href="/">Copyright © 2021-2021 XXX</a></p></div></footer><a id="s-top" class="fas fa-arrow-up fa-fw" href="javascript:void(0)" rel="external nofollow noreferrer"></a></div></div><div><script>function VPjax(){function e(e,t){this.name=t||e.name,this.run=()=>{e()}}this.list=[],this.start=()=>{for(var e=0;e<this.list.length;e++)this.list[e].run()},this.push=(t,n)=>{var i=new e(t,n);this.list.push(i)}}function loadScript(e,t){setTimeout((function(){var n=document.getElementsByTagName("head")[0]||document.documentElement,i=document.createElement("script");i.setAttribute("type","text/javascript"),t&&(i.onload=t),i.setAttribute("src",e),n.appendChild(i)}))}window.volantis={},window.volantis.loadcss=document.getElementById("loadcss"),volantis.pjax={},volantis.pjax.method={complete:new VPjax,error:new VPjax,send:new VPjax},volantis.pjax={...volantis.pjax,push:volantis.pjax.method.complete.push,error:volantis.pjax.method.error.push,send:volantis.pjax.method.send.push};var loadCSS=function(e,t,n,i){var o,a=window.document,s=a.createElement("link");if(t)o=t;else{var r=(a.body||a.getElementsByTagName("head")[0]).childNodes;o=r[r.length-1]}var d=a.styleSheets;if(i)for(var l in i)i.hasOwnProperty(l)&&s.setAttribute(l,i[l]);s.rel="stylesheet",s.href=e,s.media="only x",function e(t){if(a.body)return t();setTimeout((function(){e(t)}))}((function(){o.parentNode.insertBefore(s,t?o:o.nextSibling)}));var u=function(e){for(var t=s.href,n=d.length;n--;)if(d[n].href===t)return e();setTimeout((function(){u(e)}))};function h(){s.addEventListener&&s.removeEventListener("load",h),s.media=n||"all"}return s.addEventListener&&s.addEventListener("load",h),s.onloadcssdefined=u,u(h),s}</script><script>loadCSS("https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/css/all.min.css",window.volantis.loadcss),loadCSS("https://cdn.jsdelivr.net/gh/l-lin/font-awesome-animation/dist/font-awesome-animation.min.css",window.volantis.loadcss),loadCSS("https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css",window.volantis.loadcss)</script><script src="https://cdn.jsdelivr.net/npm/jquery@3.5/dist/jquery.min.js"></script><script>function pjax_fancybox(){$(".md .gallery").find("img").each((function(){var a=document.createElement("a");$(a).attr("class","fancybox"),$(a).attr("pjax-fancybox",""),$(a).attr("href",$(this).attr("src")),$(this).attr("data-original")&&$(a).attr("href",$(this).attr("data-original")),$(a).attr("data-fancybox","images");var t="";$(this).attr("alt")&&($(a).attr("data-caption",$(this).attr("alt")),t=$(this).attr("alt"));var n=document.createElement("div");$(n).addClass("fancybox"),$(this).wrap(n);var o=document.createElement("span");$(o).addClass("image-caption"),$(o).text(t),$(this).after(o),$(this).wrap(a)})),$(".md .gallery").find("img").fancybox({selector:'[data-fancybox="images"]',hash:!1,loop:!1,closeClick:!0,helpers:{overlay:{closeClick:!0}},buttons:["zoom","close"]})}function SCload_fancybox(){0!=$(".md .gallery").find("img").length&&(loadCSS("https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css",document.getElementById("loadcss")),loadScript("https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js",pjax_fancybox))}function Pjax_SCload_fancybox(){void 0===$.fancybox?SCload_fancybox():pjax_fancybox()}$((function(){SCload_fancybox()})),volantis.pjax.push(Pjax_SCload_fancybox),volantis.pjax.send(()=>{void 0!==$.fancybox&&$.fancybox.close()},"fancybox")</script><script src="https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js"></script><script type="text/javascript">var imgs=["https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/001.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/002.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/003.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/004.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/005.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/006.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/012.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/016.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/019.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/025.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/033.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/034.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/035.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/038.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/039.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/042.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/046.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/051.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/052.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/054.jpg","https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/056.jpg"];{function shuffle(t){for(var n=t.length;n--;){var i=Math.floor(Math.random()*n),l=t[i];t[i]=t[n],t[n]=l}}shuffle(imgs)}function Pjax_backstretch(){$("#cover-backstretch").backstretch(imgs,{duration:"10000",fade:"1500"})}loadScript("https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js",Pjax_backstretch)</script><div id="rightmenu-wrapper"><ul class="list-v rightmenu" id="rightmenu-content"><li class="option"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-text" onclick='document.execCommand("copy")'><i class="fa fa-copy fa-fw"></i> 复制文本</a><hr id="hr-text"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-href"><i class="fa fa-link fa-fw"></i> 复制链接</a><a class="vlts-menu opt fix-cursor-default" id="menu-open-href"><i class="fa fa-external-link-square-alt fa-fw"></i> 在新标签页打开</a><hr id="hr-href"><a class="vlts-menu opt fix-cursor-default" id="menu-copy-src"><i class="fa fa-image fa-fw"></i> 复制图片地址</a><hr id="hr-src"></li><li class="navigation"><a class="nav icon-only fix-cursor-default" onclick="history.back()"><i class="fa fa-arrow-left fa-fw"></i></a><a class="nav icon-only fix-cursor-default" onclick="history.forward()"><i class="fa fa-arrow-right fa-fw"></i></a><a class="nav icon-only fix-cursor-default" onclick="window.location.reload()"><i class="fa fa-redo fa-fw"></i></a><a class="nav icon-only fix-cursor-default" href="/"><i class="fa fa-home fa-fw"></i></a></li><hr><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/faqs/" id="https:volantisjsorgfaqs"><i class="fa fa-question fa-fw"></i> 常见问题</a></li><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/examples/" id="https:volantisjsorgexamples"><i class="fa fa-rss fa-fw"></i> 示例博客</a></li><li><a class="vlts-menu fix-cursor-default" href="https://volantis.js.org/contributors/" id="https:volantisjsorgcontributors"><i class="fa fa-fan fa-spin fa-fw"></i> 加入社区</a></li><hr><li><a class="vlts-menu fix-cursor-default" href="https://github.com/volantis-x/volantis-docs/" id="https:githubcomvolantis-xvolantis-docs"><i class="fa fa-code-branch fa-fw"></i> 本站源码</a></li><li><a class="vlts-menu fix-cursor-default" href="https://github.com/volantis-x/hexo-theme-volantis/" id="https:githubcomvolantis-xhexo-theme-volantis"><i class="fa fa-code-branch fa-fw"></i> 主题源码</a></li><hr><li><a class="vlts-menu fix-cursor-default" onclick='document.execCommand("print")'><i class="fa fa-print fa-fw"></i> 打印页面</a></li><hr><li><a class="vlts-menu fix-cursor-default toggle-mode-btn"><i class="fas fa-moon fa-fw"></i> Dark</a></li><hr><li class="music name"><p class="nav music-title fix-cursor-default"></p></li><li class="music ctrl"><a class="nav icon-only backward fix-cursor-default" onclick="aplayerBackward()"><i class="fa fa-step-backward fa-fw"></i></a><a class="nav icon-only toggle fix-cursor-default" onclick="aplayerToggle()"><i class="fa fa-play fa-fw"></i></a><a class="nav icon-only forward fix-cursor-default" onclick="aplayerForward()"><i class="fa fa-step-forward fa-fw"></i></a></li><li class="music volume"><a class="nav volume"><div class="aplayer-volume-bar-wrap"><div class="aplayer-volume-bar fix-cursor-pointer"><div class="aplayer-volume"></div><i class="left fa fa-volume-off fa-fw"></i><i class="right fa fa-volume-up fa-fw"></i></div></div></a></li></ul></div><script>function popMenu(e){var t=document.getElementById("rightmenu-wrapper"),n=document.getElementById("rightmenu-content"),l=document.documentElement.clientWidth||document.body.clientWidth,o=document.documentElement.clientHeight||document.body.clientHeight;t.style.left=e.clientX+"px",t.style.top=e.clientY+"px",t.style.display="block",2*e.clientX>l?n.classList.add("left"):n.classList.remove("left"),2*e.clientY>o?n.classList.add("top"):n.classList.remove("top");let c=document.getElementById("hr-text"),d=document.getElementById("hr-src"),y=document.getElementById("hr-href"),s=document.getElementById("menu-copy-src");null!=s&&(e.target.currentSrc?(s.style.display="block",s.addEventListener("click",(function(t){copyString(e.target.currentSrc)}),{once:!0}),d.style.display="block"):(s.style.display="none",d.style.display="none"));let r="";if(e.path)for(i=0;i<e.path.length;i++)null!=e.path[i].href&&e.path[i].href.length>0&&(r=e.path[i].href);let u=document.getElementById("menu-copy-text");u.style.display="none",c.style.display="none",0==r.length&&window.getSelection().toString()&&(u.style.display="block",c.style.display="block");let m=document.getElementById("menu-open-href");null!=m&&(r.length>0?(m.style.display="block",m.addEventListener("click",(function(e){window.open(r)}),{once:!0}),y.style.display="block"):(m.style.display="none",y.style.display="none"));let a=document.getElementById("menu-copy-href");return null!=a&&(r.length>0?(a.style.display="block",a.addEventListener("click",(function(e){copyString(r)}),{once:!0})):a.style.display="none"),volantis.APlayerLoaded&&checkAPlayer(),!1}function hideMenu(){document.getElementById("rightmenu-wrapper").style.display="none"}function copyString(e){const t=document.createElement("input");t.setAttribute("readonly","readonly"),document.body.appendChild(t),t.setAttribute("value",e),t.select(),document.execCommand("copy"),document.body.removeChild(t)}window.document.oncontextmenu=function(e){return!!e.ctrlKey||(!!/Android|webOS|BlackBerry/i.test(navigator.userAgent)||popMenu(e))},document.addEventListener("click",(function(e){document.getElementById("rightmenu-wrapper").style.display="none"})),document.execCommand("click")</script><script>function loadIssuesJS(){0!=$(".md").find(".issues-api").length&&loadScript("https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/issues.min.js")}$((function(){loadIssuesJS()})),volantis.pjax.push(()=>{"undefined"==typeof IssuesAPI&&loadIssuesJS()},"IssuesJS")</script><script defer="defer" src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script><script>window.lazyLoadOptions={elements_selector:".lazyload",threshold:0},window.addEventListener("LazyLoad::Initialized",(function(n){window.lazyLoadInstance=n.detail.instance}),!1),document.addEventListener("DOMContentLoaded",(function(){lazyLoadInstance.update()})),document.addEventListener("pjax:complete",(function(){lazyLoadInstance.update()}))</script><script>window.FPConfig={delay:0,ignoreKeywords:[],maxRPS:5,hoverDelay:25}</script><script defer="defer" src="https://cdn.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js"></script><script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script><script>var clipboard=new ClipboardJS(".btn-copy",{target:function(e){return e.nextElementSibling}});function wait(e,i){window.setTimeout(e,i)}function pjax_initCopyCode(){if($(".highlight .code pre").length+$(".article pre code").length!=0){var e="";e+='<button class="btn-copy" data-clipboard-snippet="">',e+='<i class="fas fa-copy"></i><span>COPY</span>',e+="</button>",$(".highlight .code pre").before(e),$(".article pre code").before(e),clipboard.off("success").on("success",(function(e){let i=$(e.trigger);i.addClass("copied");let a=$(i.find("i"));a.removeClass("fa-copy"),a.addClass("fa-check-circle");let n=$(i.find("span"));n[0].innerText="COPIED",wait((function(){a.removeClass("fa-check-circle"),a.addClass("fa-copy"),n[0].innerText="COPY"}),2e3)})),clipboard.off("error").on("error",(function(e){e.clearSelection();let i=$(e.trigger);i.addClass("copy-failed");let a=$(i.find("i"));a.removeClass("fa-copy"),a.addClass("fa-times-circle");let n=$(i.find("span"));n[0].innerText="COPY FAILED",wait((function(){a.removeClass("fa-times-circle"),a.addClass("fa-copy"),n[0].innerText="COPY"}),2e3)}))}}$((function(){pjax_initCopyCode()})),volantis.pjax.push(pjax_initCopyCode)</script><script type="text/javascript">function pjax_scrollrebeal(){ScrollReveal().reveal(".l_main .reveal",{distance:"32px",duration:"800",interval:"20",scale:"1",easing:"ease-out"})}loadScript("https://cdn.jsdelivr.net/npm/scrollreveal@4.0.6/dist/scrollreveal.min.js"),$((function(){var e=setInterval((function(){"block"==$("#safearea").css("display")&&"undefined"!=typeof ScrollReveal&&(clearInterval(e),pjax_scrollrebeal())}),100)})),volantis.pjax.push(pjax_scrollrebeal)</script><script>let APlayerController=new Object;APlayerController.id="5472211102",APlayerController.volume="0.7",loadCSS("https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css",window.volantis.loadcss),loadScript("https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"),window.volantis.APlayerLoaded=0;var checkAPlayer=setInterval((function(){window.APlayer&&"block"==$("#safearea").css("display")&&(clearInterval(checkAPlayer),window.volantis.APlayerLoaded||window.MetingJSElement||(window.volantis.APlayerLoaded=1,loadScript("https://cdn.jsdelivr.net/npm/meting@2.0/dist/Meting.min.js")))}),2500);loadScript("https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/aplayer.min.js")</script><script src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/valine.min.js"></script><script>function emoji(i,e,a){return i+"/"+i+"-"+e+"."+a}for(var emojiMaps={},i=1;i<=54;i++)emojiMaps["tieba-"+i]=emoji("tieba",i,"png");for(i=1;i<=101;i++)emojiMaps["qq-"+i]=emoji("qq",i,"gif");for(i=1;i<=116;i++)emojiMaps["aru-"+i]=emoji("aru",i,"gif");for(i=1;i<=125;i++)emojiMaps["twemoji-"+i]=emoji("twemoji",i,"png");for(i=1;i<=4;i++)emojiMaps["weibo-"+i]=emoji("weibo",i,"png");function pjax_valine(){if(!document.querySelectorAll("#valine_container")[0])return;let i=pdata.commentPlaceholder||"快来评论吧~",e=pdata.commentPath;if(0==e.length){e=""||decodeURI(window.location.pathname)}(new Valine).init(Object.assign({path:null,placeholder:"快来评论吧~",appId:"eL9fCmXLl3nAe225XYo1cRxj-MdYXbMMI",appKey:"5uTd5Uu8WJJIej6Efrivsvaa",meta:["nick","mail","link"],requiredFields:["nick","mail"],enableQQ:!0,recordIP:!1,avatar:"robohash",pageSize:10,lang:"zh-cn",highlight:!0,mathJax:!1},{el:"#valine_container",path:e,placeholder:i,emojiCDN:"https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/",emojiMaps:emojiMaps}))}$((function(){pjax_valine()})),volantis.pjax.push(pjax_valine)</script><script defer="defer" src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js" data-pjax></script><script src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@4.3.1/source/js/app.min.js"></script><script>const SearchServiceimagePath="https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/img/",ROOT="/".endsWith("/")?"/":"//";function listenSearch(){customSearch=new HexoSearch({imagePath:SearchServiceimagePath})}function setSearchService(){listenSearch()}$(".input.u-search-input").one("focus",(function(){loadScript("https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@2.6.4/js/search.js",setSearchService)}))</script><script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script><script type="text/javascript">$((function(){Waves.attach(".flat-btn",["waves-button"]),Waves.attach(".float-btn",["waves-button","waves-float"]),Waves.attach(".float-btn-light",["waves-button","waves-float","waves-light"]),Waves.attach(".flat-box",["waves-block"]),Waves.attach(".float-box",["waves-block","waves-float"]),Waves.attach(".waves-image"),Waves.init()}))</script><script src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@2/js/comment_typing.js"></script><script defer="defer">const LCCounter={app_id:"C2dIVXJ48qC7eHgvQRId6niR-MdYXbMMI",app_key:"1956OGJ4LQhDxheBAO5WhPJn",custom_api_server:"",getRecord:(e,t,r)=>new Promise((function(n,i){e("get","/classes/Counter?where="+encodeURIComponent(JSON.stringify({url:t}))).then(e=>e.json()).then(({results:o,code:s,error:a})=>{if(401===s)throw a;if(o&&o.length>0){var l=o[0];n(l)}else e("post","/classes/Counter",{url:t,title:r,times:0}).then(e=>e.json()).then((e,t)=>{if(t)throw t;n(e)}).catch(e=>{console.error("Failed to create",e),i(e)})}).catch(e=>{console.error("LeanCloud Counter Error:",e),i(e)})})),increment:(e,t)=>new Promise((function(r,n){e("post","/batch",{requests:t}).then(e=>{if((e=e.json()).error)throw e.error;r(e)}).catch(e=>{console.error("Failed to save visitor count",e),n(e)})})),buildIncrement:e=>({method:"PUT",path:"/1.1/classes/Counter/"+e,body:{times:{__op:"Increment",amount:1}}}),validUV(){var e="LeanCloudUVTimestamp",t=localStorage.getItem(e);return!(t&&(new Date).getTime()-parseInt(t)<=864e5)&&(localStorage.setItem(e,(new Date).getTime().toString()),!0)},addCount(e){var t=[],r=[],n=document.querySelector("#lc-sv"),o=this.getRecord(e,"http://aner1001.gitee.io/#lc-sv","Visits").then(e=>{r.push(this.buildIncrement(e.objectId));var t=document.querySelectorAll("#lc-sv #number");t.length>0&&t.forEach((t,r,i)=>{t.innerText=e.times+1,n&&(n.style.display="inline")})});t.push(o);var s=document.querySelector("#lc-uv"),a=this.getRecord(e,"http://aner1001.gitee.io/#lc-uv","Visitors").then(e=>{var t=this.validUV();t&&r.push(this.buildIncrement(e.objectId));var n=document.querySelectorAll("#lc-uv #number");n.length>0&&n.forEach((r,n,i)=>{r.innerText=e.times+(t?1:0),s&&(s.style.display="inline")})});t.push(a);var l=document.querySelectorAll("#lc-pv");for(l.length,i=0;i<l.length;i++){let n=l[i],o=n.getAttribute("data-title");var h="http://aner1001.gitee.io"+n.getAttribute("data-path");if(h){var c=this.getRecord(e,h,o).then(e=>{let t=window.location.pathname;if(t.includes("index.html")&&(t=t.substring(0,t.lastIndexOf("index.html"))),n.getAttribute("data-path")==t&&r.push(this.buildIncrement(e.objectId)),n){var i=n.querySelector("#lc-pv #number");i&&(n.getAttribute("data-path")==t?i.innerText=(e.times||0)+1:i.innerText=e.times||0,n.style.display="inline")}});t.push(c)}}Promise.all(t).then(()=>{r.length>0&&this.increment(e,r)})},fetchData(e){this.addCount((t,r,n)=>fetch(`${e}/1.1${r}`,{method:t,headers:{"X-LC-Id":this.app_id,"X-LC-Key":this.app_key,"Content-Type":"application/json"},body:JSON.stringify(n)}))},refreshCounter(){var e="-MdYXbMMI"!==this.app_id.slice(-9)?this.custom_api_server:`https://${this.app_id.slice(0,8).toLowerCase()}.api.lncldglobal.com`;e?this.fetchData(e):fetch("https://app-router.leancloud.cn/2/route?appId="+this.app_id).then(e=>e.json()).then(({api_server:e})=>{this.fetchData("https://"+e)})}};LCCounter.refreshCounter(),document.addEventListener("pjax:complete",(function(){LCCounter.refreshCounter()}))</script><script>const rootElement=document.documentElement,darkModeStorageKey="user-color-scheme",rootElementDarkModeAttributeName="data-user-color-scheme",setLS=(e,t)=>{localStorage.setItem(e,t)},removeLS=e=>{localStorage.removeItem(e)},getLS=e=>localStorage.getItem(e),getModeFromCSSMediaQuery=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",resetRootDarkModeAttributeAndLS=()=>{var e;rootElement.removeAttribute("data-user-color-scheme"),e=darkModeStorageKey,localStorage.removeItem(e)},validColorModeKeys={dark:!0,light:!0},applyCustomDarkModeSettings=e=>{const t=e||getLS(darkModeStorageKey);t===getModeFromCSSMediaQuery()?resetRootDarkModeAttributeAndLS():validColorModeKeys[t]?rootElement.setAttribute("data-user-color-scheme",t):resetRootDarkModeAttributeAndLS()},invertDarkModeObj={dark:"light",light:"dark"},toggleCustomDarkMode=()=>{let e=getLS(darkModeStorageKey);if(validColorModeKeys[e])e=invertDarkModeObj[e];else{if(null!==e)return;e=invertDarkModeObj[getModeFromCSSMediaQuery()]}var t,o;return t=darkModeStorageKey,o=e,localStorage.setItem(t,o),e};var btn=$("#wrapper .toggle-mode-btn,#rightmenu-wrapper .toggle-mode-btn");function bindToggleButton(){btn.on("click",e=>{const t=toggleCustomDarkMode();applyCustomDarkModeSettings(t)})}applyCustomDarkModeSettings(),document.addEventListener("DOMContentLoaded",bindToggleButton),volantis.pjax.push(bindToggleButton),volantis.pjax.send(()=>{btn.unbind("click")},"toggle-mode-btn-unbind")</script><script>function listennSidebarTOC(){const e=document.querySelectorAll(".toc li");if(!e.length)return;const t=[...e].map(e=>{const t=e.querySelector(".toc-link"),n=document.getElementById(decodeURI(t.getAttribute("href")).replace("#",""));return t.addEventListener("click",e=>{e.preventDefault(),window.scrollTo({top:n.offsetTop+100,behavior:"smooth"})}),n});!function n(o){o=Math.floor(o+1e4);let r=new IntersectionObserver((r,c)=>{let i=document.documentElement.scrollHeight+100;if(i>o)return c.disconnect(),void n(i);let l=function(e){let n=0,o=e[n];if(o.boundingClientRect.top>0)return n=t.indexOf(o.target),0===n?0:n-1;for(;n<e.length;n++){if(!(e[n].boundingClientRect.top<=0))return t.indexOf(o.target);o=e[n]}return t.indexOf(o.target)}(r);!function(e){if(e.classList.contains("active-current"))return;document.querySelectorAll(".toc .active").forEach(e=>{e.classList.remove("active","active-current")}),e.classList.add("active","active-current");let t=e.parentNode;for(;!t.matches(".toc");)t.matches("li")&&t.classList.add("active"),t=t.parentNode}(e[l])},{rootMargin:o+"px 0px -100% 0px",threshold:0});t.forEach(e=>{e&&r.observe(e)})}(document.documentElement.scrollHeight)}document.addEventListener("DOMContentLoaded",listennSidebarTOC),document.addEventListener("pjax:success",listennSidebarTOC)</script><script>"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then((function(e){e.onupdatefound=function(){var r=e.installing;r.onstatechange=function(){switch(r.state){case"installed":navigator.serviceWorker.controller?console.log("Updated serviceWorker."):console.log("serviceWorker Sucess!");break;case"redundant":console.log("The installing service worker became redundant.")}}}})).catch((function(e){console.log("Error during service worker registration:",e)}))</script><script src="https://cdn.jsdelivr.net/npm/pjax@0.2.8/pjax.min.js"></script><div class="pjax-animate"><script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script><div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed:100})</script></div><script>window.ShowLoading=function(){NProgress.start()},window.HideLoading=function(){NProgress.done()}</script><script>volantis.pjax.push(window.HideLoading,"HideLoading"),volantis.pjax.send(window.ShowLoading,"ShowLoading"),volantis.pjax.error(window.HideLoading,"HideLoading")</script></div><script>var pjax;document.addEventListener("DOMContentLoaded",(function(){pjax=new Pjax({elements:'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox])',selectors:["title","#pjax-container","#pjax-header-nav-list"],cacheBust:!1,timeout:5e3})})),document.addEventListener("pjax:send",(function(e){try{var n=window.location.pathname,t=e.triggerElement.href,o=[""];""!=o[0]&&o.forEach(e=>{-1==n.indexOf(e)&&-1==t.indexOf(e)||(window.location.href=t)})}catch(e){}window.subData=null,volantis.$switcher.removeClass("active"),volantis.$header.removeClass("z_search-open"),volantis.$wrapper.removeClass("sub"),volantis.$topBtn.unbind("click"),$(".menu a").unbind("click"),$(window).unbind("resize"),$(window).unbind("scroll"),$(document).unbind("scroll"),$(document).unbind("click"),$("body").unbind("click"),volantis.pjax.method.send.start()})),document.addEventListener("pjax:complete",(function(){$(".nav-main").find(".list-v").not(".menu-phone").removeAttr("style",""),$(".menu-phone.list-v").removeAttr("style",""),$("script[data-pjax], .pjax-reload script").each((function(){$(this).parent().append($(this).remove())}));try{volantis.pjax.method.complete.start()}catch(e){console.log(e)}})),document.addEventListener("pjax:error",(function(e){volantis.pjax.method.error.start(),window.location.href=e.triggerElement.href}))</script></div></body></html>